
#include <BRotateChannel>
#include "member_BRotateChannel.h"

using namespace BWE;

#define member					(*(member_BRotateChannel*)_ptr)
#define member_allocate()		_ptr = new member_BRotateChannel(this)
#define member_release()		delete (member_BRotateChannel*)_ptr

BRotateChannel::BRotateChannel()
{
	member_allocate();
	this->setLerp(Lerp_Linear);
}
BRotateChannel::BRotateChannel(const BString& name)
{
	member_allocate();
	this->setLerp(Lerp_Linear);
	this->setName(name);
}
BRotateChannel::~BRotateChannel()
{
	member_release();
}

void BRotateChannel::addKeyframe(float time, const BQuater& quater)
{
	BQuaterKeyframe keyframe(time, quater);
	member.keyframes.append(keyframe);
}
void BRotateChannel::addKeyframe(const BQuaterKeyframe& keyframe)
{
	member.keyframes.append(keyframe);
}

bool BRotateChannel::insertKeyframe(int index)
{
	return member.keyframes.insert(index, BQuater());
}
bool BRotateChannel::removeKeyframe(int index)
{
	return member.keyframes.remove(index);
}

int BRotateChannel::keyframeCount() const
{
	return member.keyframes.size();
}
const BQuaterKeyframe& BRotateChannel::keyframe(int index) const
{
	return member.keyframes(index);
}

bool BRotateChannel::accept(BObject* object)
{
	BNode* node = dynamic_cast<BNode*>(object);
	if (node)
		return true;
	return false;
}
void BRotateChannel::apply(BObject* object)
{

}
void BRotateChannel::fresh(double time)
{

}
